home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Source.bin / SocialInsuranceNumberBeanInfo.java < prev    next >
Text File  |  1998-08-21  |  3KB  |  102 lines

  1. package symantec.itools.awt.util.edit;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. //  09/07/97    LAB    Fixed misspelling of descriptions.
  8. //  09/13/97    LAB    Removed extranious getMethodDescriptors method.
  9.  
  10. /**
  11.  * BeanInfo for SocialInsuranceNumber.
  12.  *
  13.  */
  14. public class SocialInsuranceNumberBeanInfo extends SimpleBeanInfo {
  15.  
  16.     /**
  17.      * Constructs a SocialInsuranceNumberBeanInfo object.
  18.      */
  19.     public SocialInsuranceNumberBeanInfo() {
  20.     }
  21.  
  22.     /**
  23.      * Gets a BeanInfo for the superclass of this bean.
  24.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  25.      */
  26.     public BeanInfo[] getAdditionalBeanInfo() {
  27.         try {
  28.             BeanInfo[] bi = new BeanInfo[1];
  29.             bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
  30.             return bi;
  31.         }
  32.         catch (IntrospectionException e) { throw new Error(e.toString());}
  33.     }
  34.  
  35.     /**
  36.      * Gets the SymantecBeanDescriptor for this bean.
  37.      * @return an object of type SymantecBeanDescriptor
  38.      * @see symantec.itools.beans.SymantecBeanDescriptor
  39.      */
  40.     public BeanDescriptor getBeanDescriptor() {
  41.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  42.         String s=group.getString("GroupPreDefinedTF"); 
  43.  
  44.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  45.         bd.setFolder(s);
  46.         bd.setWinHelp("0x123C6");
  47.  
  48.         return (BeanDescriptor) bd;
  49.     }
  50.  
  51.     /**
  52.      * Gets an image that may be used to visually represent this bean
  53.      * (in the toolbar, on a form, etc).
  54.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  55.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  56.      * @return an image for this bean, always color even if requested monochrome
  57.      * @see BeanInfo#ICON_MONO_16x16
  58.      * @see BeanInfo#ICON_COLOR_16x16
  59.      * @see BeanInfo#ICON_MONO_32x32
  60.      * @see BeanInfo#ICON_COLOR_32x32
  61.      */
  62.     public java.awt.Image getIcon(int iconKind) {
  63.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  64.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  65.             java.awt.Image img = loadImage("SocialInsuranceNumberC16.gif");
  66.             return img;
  67.         }
  68.  
  69.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  70.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  71.             java.awt.Image img = loadImage("SocialInsuranceNumberC32.gif");
  72.             return img;
  73.         }
  74.  
  75.         return null;
  76.     }
  77.  
  78.     public MethodDescriptor[] getMethodDescriptors() { return new MethodDescriptor[0]; }
  79.  
  80.     /**
  81.      * Returns descriptions of this bean's properties.
  82.      */
  83.     public PropertyDescriptor[] getPropertyDescriptors() {
  84.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
  85.  
  86.         try{
  87.         PropertyDescriptor mask = new PropertyDescriptor("mask", beanClass);
  88.         mask.setHidden(true);
  89.  
  90.         PropertyDescriptor roMask = new PropertyDescriptor("roMask", beanClass, "getMask", null);
  91.         roMask.setDisplayName(prop.getString("roMask"));
  92.  
  93.         PropertyDescriptor[] rv = {
  94.             mask,
  95.             roMask};
  96.         return rv;
  97.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  98.     }
  99.  
  100.     private final static Class beanClass = SocialInsuranceNumber.class;
  101.  
  102.     }    //  end of class SocialInsuranceNumberBeanInfo